﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebDemo.aspx.cs" Inherits="Form_WebDemo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ECG示例</title>
        <script language="javascript" type="text/javascript" src="../JS/ChkInputs.min.js"></script>
        <script language="javascript" type="text/javascript">
        //增加
	    function Add()
	    {
		    var v_url = "WebDemoEdit.aspx?CMD=Add";
		    var v_dialogreturn = window.showModalDialog(v_url,'','dialogheight:350px;dialogwidth:850px;center:yes;help:no;resizable:no;status:no;');
		    if(v_dialogreturn == "1")
		    {
		        document.getElementById("btnHidBindData").click();
		    }
		    return CancelClientEvent();
	    }
	    function Edit(url)
	    {
		    var v_dialogreturn = window.showModalDialog(url,'','dialogheight:350px;dialogwidth:850px;center:yes;help:no;resizable:no;status:no;');
		    if(v_dialogreturn == "1")
		    {
		        document.getElementById("btnHidBindData").click();
		    }
	    }
        //删除
        function CheckDelete()
        {
            var gvList = document.getElementById("gvResult");
            if(gvList==null) 
            {
                alert("请选择记录！");
                return false;
            }
            var count = 0;
            for(i = 1;i < gvList.rows.length - 1; i++)
            {
                if(gvList.rows[i].cells[0].getElementsByTagName("INPUT")[0] != null 
                    && gvList.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked)
                {
                    count++;
                }
            }
            if(count < 1)
            {
                alert("请选择记录！");
                return false;
            }
            else
            {
                if(window.confirm("您确定要删除选定的记录吗?")==true)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <table width="800px" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="3">&nbsp;</td>
            </tr>
            <tr>
                <td align="left">
                    <asp:Button ID="btnSave" runat="server" Text="增加" Width="60px"
                        OnClientClick="return Add();" />
                    <asp:Button ID="btnDelete" runat="server" Text="删除" Width="60px"
                        OnClientClick="return CheckDelete();" OnClick="btnDelete_Click" />
                </td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td colspan="3">
                    <asp:GridView ID="gvResult" runat="server" AllowSorting="True" AutoGenerateColumns="False" HorizontalAlign="Center"
                        ShowFooter="True" Width="800px" AllowPaging="True" PageSize="15" OnRowDataBound="gvResult_RowDataBound" OnSorting="gvResult_Sorting" DataKeyNames="C_ID,C_EIDTDATE,C_INT,C_INTA,C_INTB" OnPageIndexChanging="gvResult_PageIndexChanging">
                        <Columns>
                            <asp:TemplateField HeaderText="选择">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chk" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="C_ID" HeaderText="流水号" ReadOnly="True" FooterText="小计" SortExpression="C_ID">
                                <FooterStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="C_NAME" HeaderText="名称" SortExpression="C_NAME"/>
                            <asp:BoundField DataField="C_IDCARD" HeaderText="身份证号" SortExpression="C_IDCARD"/>
                            <asp:BoundField DataField="C_DATE" DataFormatString="{0:yyyy-MM-dd}" HeaderText="填写日期" SortExpression="C_DATE"/>
                            <asp:BoundField DataField="C_STRING" HeaderText="字符串" SortExpression="C_STRING"/>
                            <asp:BoundField DataField="C_STRINGA" HeaderText="字符串A" SortExpression="C_STRINGA"/>
                            <asp:BoundField DataField="C_STRINGB" HeaderText="字符串B" SortExpression="C_STRINGB"/>
                            <asp:BoundField DataField="C_EMAIL" HeaderText="电子邮件" SortExpression="C_EMAIL"/>
                            <asp:BoundField DataField="C_INT" HeaderText="整数" SortExpression="C_INT">
                                <FooterStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="C_INTA" HeaderText="正整数" SortExpression="C_INTA">
                                <FooterStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="C_INTB" HeaderText="负整数" SortExpression="C_INTB">
                                <FooterStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="C_FLOAT" HeaderText="浮点数" SortExpression="C_FLOAT"/>
                            <asp:BoundField DataField="C_FLOATA" HeaderText="正浮点数" SortExpression="C_FLOATA"/>
                            <asp:BoundField DataField="C_FLOATB" HeaderText="负浮点数" SortExpression="C_FLOATB"/>
                        </Columns>
                        <EmptyDataTemplate>
                            还未填写数据!
                        </EmptyDataTemplate>
                        <PagerSettings Mode="NumericFirstLast" />
                    </asp:GridView>
                    <div style="display: none;">
                        <asp:Button ID="btnHidBindData" runat="server" OnClick="btnHidBindData_Click" Text="btnHidBindData" />
                    </div>
                </td>
            </tr>
        </table>
    </center>
    </form>
</body>
</html>
